package ljl.alg.jianzhioffer.round2;

/*
* 老题
* */
public class _15_count_i {
    
    public int hammingWeight(int n) {
        int c = 0;
        // 这不能是 n > 0
        while (n != 0) {
            n &= n - 1;
            c++;
        }
        return c;
    }
}
